<%
################################################################################
# NOTE: It is STRONGLY suggested that if you wish to customize the look and feel
# of your Helpy, that you create a custom theme instead.  This will allow
# you to override any views or styles you wish to, without compromising your
# ability to upgrade in the future
################################################################################
%>

<% title "#{AppSettings['settings.site_name']}: #{@page_title}" %>
<% meta_tag :description, "Knowledgebase for #{AppSettings['settings.site_name']}" %>
<% meta_tag :keywords, "Knowledgebase, Knowledge base, support, articles, documentation, how-to, faq, frequently asked questions" %>

<div class="row content-row">
	<%= render 'left_nav' %>
	<% if @categories.count == 0 %>

		<div class="nothing-in-locale col-md-12 text-center verticalness">
			<%= t(:nothing_here) %>
		</div>

	<% else %>

			<div class="col-md-3"><!-- this div is a spacer --></div>
			<div id="category-col" class="col-md-9">
				<% @categories.each do |category| %>
					<% if category.docs.all.with_translations(I18n.locale).count > 0 %>
					<div class="row">
						<div class="col-md-9">
							<h5 class="tiny-header"><%= link_to category.name, category_path(category), id: "category-#{category.id}", class:'tiny-header'  %></h5>
							<ul class='list-unstyled articles'>
								<%= render partial: 'categories/category', collection: Category.children_of(category).ordered.with_translations(I18n.locale).all %>
								<% category.docs.with_translations(I18n.locale).ordered.active.includes(:tags).limit(15).each_with_index do |doc| -%>
									<%= render ("docs/doc"), doc: doc -%>
								<% end -%>
								<li class="article article-more">
									<%= link_to "More Documents", category_path(category) if category.docs.ordered.active.count > 15 -%>
								</li>

							</ul>
						</div>
					</div>
					<% end %>
				<% end %>
			</div>


		<% if Doc.all.with_translations(I18n.locale).count == 0 %>
			<div class="nothing-in-locale col-md-12 text-center verticalness">
				<%= t(:nothing_here) %>
			</div>
		<% end %>
	<% end %>
</div>
